<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <button id="btn">dianji</button>
        <div id="box">按时看见但哈开始就</div>
    </body>
    <script>
        // document.getElementById('btn').onclick = () => {
        //     console.log(this)
        // }
        document.getElementById('btn').onclick = function () {
            console.log('btn', this) //当前的btn
            document.getElementById('box').onclick = () => {
                console.log('div', this) //当前的btn
            }
        }
        //箭头函数中的this指向的是上下文中的this
    </script>
</html>
